#!/bin/sh
LD_LIBRARY_PATH=.
export LD_LIBRARY_PATH

# Removing Old .o .so and executables
echo make: removing old stuffs
rm *.o 2> /dev/null
rm *.so 2> /dev/null
rm ./examples/test ./examples/test2 2> /dev/null
echo make: Done.

# Command for creating .o
echo make: creating object file ...
gcc -fPIC -c -Wall -pthread -I/usr/local/include/vortex -I/usr/local/include/axl -L/usr/local/lib -lvortex -lssl -lcrypto -lgsasl -lpthread -laxl -lm -I/usr/local/include/libxml2 -L/usr/local/lib -lxml2 -lz -lm libidxp.c 2>./audit_obj
echo make: Done.

# Command for creating .so
echo make: creating library ...
gcc -shared -Wl -o libidxp.so libidxp.o -lc 2>./audit_so
cp libidxp.so ./examples/
echo make: Done.

# Command for creating the executable 
echo "make: creating test & test2 executables ..."
gcc -pthread -I/usr/local/include/vortex -I/usr/local/include/axl -L/usr/local/lib -lvortex -lssl -lcrypto -lgsasl -lpthread -laxl -lm -I/usr/local/include/libxml2 -L/usr/local/lib -lxml2 -lz -lm ./examples/test.c -o ./examples/test -I. -L. -lidxp
gcc -pthread -I/usr/local/include/vortex -I/usr/local/include/axl -L/usr/local/lib -lvortex -lssl -lcrypto -lgsasl -lpthread -laxl -lm -I/usr/local/include/libxml2 -L/usr/local/lib -lxml2 -lz -lm ./examples/test2.c -o ./examples/test2 -I. -L. -lidxp
echo make: Done.
exit 0
